package com.quanquan.store.repository;

import com.quanquan.store.entity.StoreFloor;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * @ClassName:StoreFloorRepository
 * @Description:商户楼层dao
 * @Author:xiongjunbao
 * @Date:2019/3/13 9:36
 * @Version 1.0
 */
public interface StoreFloorRepository extends JpaRepository<StoreFloor,String> {

    /**
     * 通过楼层查询，一个楼层可能查出多个对应关系
     * @param id
     * @return
     */
    @Query(value = "SELECT * FROM oo_store_floor WHERE floor_id = ?1 AND status_show = 0 AND status_remove = 0 ",nativeQuery = true)
    List<StoreFloor> findByFloorId(String id);

    /**
     * 通过商户查询，一个商户只会查出一个对应关系
     * @param id
     * @return
     */
    @Query(value = "SELECT * FROM oo_store_floor WHERE store_id = ?1 AND status_show = 0 AND status_remove = 0 ",nativeQuery = true)
    StoreFloor findByStoreId(String id);
}
